PkgObj=$(LosuSDK_Obj)/sdk/lpkg

cc=cc

CIncFile=\
	$(shell ls lib/*.h)\
	$(shell ls $(LosuSDK_Include)/*.h)\


cWarning= -Wall
cStd= -std=c99
cOpt= -O2
cInclude=  -Ilib -Iscript -I$(LosuSDK_Include)
cLink= -lm -L$(LosuSDK_Lib)  -l:liblosu.a 
cFlags= $(cWarning) $(cStd) $(cOpt) $(cInclude)

$(LosuSDK_Path)/lpkg:\
	$(LosuSDK_Obj)/sdk/lpkg/main.o\
	$(LosuSDK_Obj)/sdk/lpkg/lpkg.lsh.o\
	$(LosuSDK_Lib)/liblosu.a\
	
	$(cc) -o $@ $^ $(cLink)

$(LosuSDK_Obj)/sdk/lpkg/main.o: main.c $(CIncFile) 	script/lpkg.els.inc 
	$(cc) $(cFlags) -c $< -o $@
	
$(LosuSDK_Obj)/sdk/lpkg/lpkg.lsh.o: lib/lpkg.lsh.c $(CIncFile)
	$(cc) $(cFlags) -c $< -o $@

script/lpkg.els.inc: script/lpkg.els
	$(LosuSDK_Path)/losuc -c $< 